home *** CD-ROM | disk | FTP | other *** search
/ Macworld Expo - Develope…Central & Net Innovations / Developer Central and Net Innovators (MacWorld Expo) (January 1999).iso / Developer Central / Bowers Development / Demo AppMaker / Examples / plain C OS8 / Everything / EverythingEngine.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-29  |  3.8 KB  |  191 lines  |  [TEXT/CWIE]

  1. /* EverythingEngine.c -- application-specific data management */
  2.  
  3. /* This module contains data structures to access the data in your */
  4. /* document's file(s). The purpose is to isolate the details of the */
  5. /* data representation into this module and to provide accessor */
  6. /* functions for reading/writing logical pieces of the data. */
  7. /* For your application, you will probably rewrite most of this. */
  8. /* This module will not be regenerated by AppMaker unless you delete it. */
  9.  
  10. #include <Types.h>
  11. #include <Quickdraw.h>
  12. #include <Controls.h>
  13. #include <Events.h>
  14. #include <Lists.h>
  15. #include <Menus.h>
  16. #include <TextEdit.h>
  17. #include <stdlib.h>
  18.  
  19. #include "Dispatcher.h"
  20. #include "DDocData.h"
  21. #include "DModalCheckboxesData.h"
  22. #include "DModalRadiosData.h"
  23. #include "DModalTextData.h"
  24. #include "DModalStuffData.h"
  25. #include "DModalBarsData.h"
  26. #include "DModelessCheckboxesData.h"
  27. #include "DModelessRadiosData.h"
  28. #include "DModelessTextData.h"
  29. #include "DModelessStuffData.h"
  30. #include "DModelessBarsData.h"
  31. #include "Globals.h"
  32. #include "Miscellany.h"
  33. #include "EverythingEngine.h"
  34.  
  35.  
  36. //----------
  37. EverythingEngine*        NewEverythingEngine ()
  38. {
  39.     EverythingEngine*        engine;
  40.  
  41.     engine = (EverythingEngine*)malloc (sizeof (EverythingEngine));
  42.     EverythingEngine_Init (engine);
  43.     SetClassID (engine, classEverythingEngine);
  44.  
  45.     return engine;
  46. }
  47.  
  48. //----------
  49. void    DeleteEngine (
  50.     AMEngine*        engine)
  51. {
  52.     EverythingEngine_Free ((EverythingEngine*)engine);
  53.     free (engine);
  54. }
  55.  
  56. //----------
  57. void    EverythingEngine_Init (
  58.     EverythingEngine*        self)
  59. {
  60.     AMEngine_Init ((AMEngine*) self);
  61.  
  62.     self->super.mFileType = kFileType;
  63.     self->super.mSignature = kSignature;
  64. }
  65.  
  66. //----------
  67. void    EverythingEngine_Free (
  68.     EverythingEngine*        self)
  69. {
  70.     AMEngine_Free ((AMEngine*) self);
  71. }
  72.  
  73. // These are just models for your own data access functions.
  74. // Replace them with ones that do something useful.
  75.  
  76. /*----------*/
  77. DDocData*    GetDocData (
  78.     EverythingEngine*        self)
  79. {
  80.     return NewDDocData ();
  81. }
  82.  
  83. /*----------*/
  84. DModalCheckboxesData*    GetModalCheckboxesData (
  85.     EverythingEngine*        self)
  86. {
  87.     return NewDModalCheckboxesData ();
  88. }
  89.  
  90. /*----------*/
  91. DModalRadiosData*    GetModalRadiosData (
  92.     EverythingEngine*        self)
  93. {
  94.     return NewDModalRadiosData ();
  95. }
  96.  
  97. /*----------*/
  98. DModalTextData*    GetModalTextData (
  99.     EverythingEngine*        self)
  100. {
  101.     return NewDModalTextData ();
  102. }
  103.  
  104. /*----------*/
  105. DModalStuffData*    GetModalStuffData (
  106.     EverythingEngine*        self)
  107. {
  108.     return NewDModalStuffData ();
  109. }
  110.  
  111. /*----------*/
  112. DModalBarsData*    GetModalBarsData (
  113.     EverythingEngine*        self)
  114. {
  115.     return NewDModalBarsData ();
  116. }
  117.  
  118. /*----------*/
  119. DModelessCheckboxesData*    GetModelessCheckboxesData (
  120.     EverythingEngine*        self)
  121. {
  122.     return NewDModelessCheckboxesData ();
  123. }
  124.  
  125. /*----------*/
  126. DModelessRadiosData*    GetModelessRadiosData (
  127.     EverythingEngine*        self)
  128. {
  129.     return NewDModelessRadiosData ();
  130. }
  131.  
  132. /*----------*/
  133. DModelessTextData*    GetModelessTextData (
  134.     EverythingEngine*        self)
  135. {
  136.     return NewDModelessTextData ();
  137. }
  138.  
  139. /*----------*/
  140. DModelessStuffData*    GetModelessStuffData (
  141.     EverythingEngine*        self)
  142. {
  143.     return NewDModelessStuffData ();
  144. }
  145.  
  146. /*----------*/
  147. DModelessBarsData*    GetModelessBarsData (
  148.     EverythingEngine*        self)
  149. {
  150.     return NewDModelessBarsData ();
  151. }
  152.  
  153. //----------
  154. void    InitData (
  155.     AMEngine*        engine)
  156. {
  157.     EverythingEngine*        self = (EverythingEngine*) engine;
  158.  
  159.     // override to initialize your data structures
  160. }
  161.  
  162. //----------
  163. void    DisposeData (
  164.     AMEngine*        engine)
  165. {
  166.     EverythingEngine*        self = (EverythingEngine*) engine;
  167.  
  168.     // override to dispose your data structures
  169. }
  170.  
  171. //----------
  172. void    ReadFile (
  173.     AMEngine*        engine)
  174. {
  175.     EverythingEngine*        self = (EverythingEngine*) engine;
  176.  
  177.     InitData (engine);
  178.     engine->mDirty = false;
  179.     // override to read from the current file into your data structures
  180. }
  181.  
  182. //----------
  183. void    WriteFile (
  184.     AMEngine*        engine)
  185. {
  186.     EverythingEngine*        self = (EverythingEngine*) engine;
  187.  
  188.     engine->mDirty = false;
  189.     // override to write your data structures to the current file
  190. }
  191.